﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace DynamicUIFramework
{
    public static class UISetting
    {
        internal static Setting setting { get; set; }

        public static string BasePath
        {
            get { return setting.BasePath; }
        }

        public static string PartPath
        {
            get
            {
                if (string.IsNullOrEmpty(partPath))
                    partPath = Path.Combine(BasePath, setting.PartPath);

                if (Directory.Exists(partPath) == false)
                    Directory.CreateDirectory(partPath);
                return partPath;
            }
        }
        static string partPath;

        public static string RegionPath
        {
            get
            {
                if (string.IsNullOrEmpty(regionPath))
                    regionPath = Path.Combine(BasePath, setting.RegionPath);

                if (Directory.Exists(regionPath) == false)
                    Directory.CreateDirectory(regionPath);
                return regionPath;
            }
        }
        static string regionPath;

        public static string LayoutPath
        {
            get
            {
                if (string.IsNullOrEmpty(layoutPath))
                    layoutPath = Path.Combine(BasePath, setting.LayoutPath);

                return layoutPath;
            }
        }
        static string layoutPath;

        public static string DataPath
        {
            get
            {
                if (string.IsNullOrEmpty(dataPath))
                    dataPath = Path.Combine(BasePath, setting.DataPath);

                return dataPath;
            }
        }
        static string dataPath;
    }

    public struct Setting
    {
        public string BasePath;

        public string PartPath;

        public string RegionPath;

        public string LayoutPath;

        public string DataPath;
    }
}
